import util.ByteUtil;
import util.FileProtocolUtil;

import java.io.*;

public class WriteFileTest {

    public static void main(String args[]) throws Exception {
        // 文件打包测试
        // 文件部分路径
        String writeSrcFilePath = "D://2.doc";
        // 清单文件路径
        String listFilePath = "D:\\test\\20210507\\12(招标).YFJZ";
        // 拓展部分
        String jsonConfig = "{ \"programmers\": [\n" +
                "\n" +
                "{ \"firstName\": \"Brett\", \"lastName\":\"McLaughlin\", \"email\": \"aaaa\" },\n" +
                "\n" +
                "{ \"firstName\": \"Jason\", \"lastName\":\"Hunter\", \"email\": \"bbbb\" },\n" +
                "\n" +
                "{ \"firstName\": \"Elliotte\", \"lastName\":\"Harold\", \"email\": \"cccc\" }\n" +
                "\n" +
                "],\n" +
                "\n" +
                "\"authors\": [\n" +
                "\n" +
                "{ \"firstName\": \"Isaac\", \"lastName\": \"Asimov\", \"genre\": \"science fiction\" },\n" +
                "\n" +
                "{ \"firstName\": \"Tad\", \"lastName\": \"Williams\", \"genre\": \"fantasy\" },\n" +
                "\n" +
                "{ \"firstName\": \"Frank\", \"lastName\": \"Peretti\", \"genre\": \"christian fiction\" }\n" +
                "\n" +
                "],\n" +
                "\n" +
                "\"musicians\": [\n" +
                "\n" +
                "{ \"firstName\": \"Eric\", \"lastName\": \"Clapton\", \"instrument\": \"guitar\" },\n" +
                "\n" +
                "{ \"firstName\": \"Sergei\", \"lastName\": \"Rachmaninoff\", \"instrument\": \"piano\" }\n" +
                "\n" +
                "] }";
        // 打包文件存放位置
        String writeTargetFilePath = "D://test//20210507//test.spct";
        System.out.println("start write file...");
        writeTargetFilePath = FileProtocolUtil.write(writeSrcFilePath, jsonConfig,listFilePath, writeTargetFilePath);
        System.out.println("write end, the result is " + writeTargetFilePath);
    }
}
